<template>
	<view>
		<view class="aaa">
			<image src="../../static/img/logo.png" class="login_logo_img" />
				<view class="aaa_text">
					请填写邀请码
				</view>
		</view>
		<view class="verifcat">
			<u-code-input v-model="value3" type='text' :size='45' :maxlength="6"></u-code-input>
		</view>

		<view class="dl_button" @click="dl_button">
			确定
		</view>
	</view>
</template>

<script>
	import UImage
    from "../../uni_modules/uview-ui/components/u--image/u--image.vue";

  export default {
    components: {UImage},
		data() {
			return {
				value3: ''
			}
		},
		methods: {
			dl_button() {
				console.log(this.value3)
				if(this.value3 != ''){
					this.$ajax('POST', 'auth/checkInviteCode?code='+this.value3).then(res => {
						let any = res.data
						if(res.code == 200){
							uni.showToast({
								title: '验证成功',
								icon: 'none'
							});
							setTimeout(()=>{
								uni.navigateTo({
									url:'./register?inviter='+any.inviter+'&recyclerType=' + any.recyclerType
								})
							},1000)
						} else {
							uni.showToast({
								title: '验证码错误',
								icon: 'none'
							});
						}
					})

				} else{
					uni.showToast({
						title: '请输入验证码',
						icon: 'none'
					});
				}
			}
		}
	}
</script>

<style>
	page {
		background-image: url('../../static/img/bj.jpg');
		background-size: cover;
	}
	.verifcat {
		display: flex;
		align-items: center;
		justify-content: center;

	}

	.input_flex {
		width: 80%;
		display: flex;
		align-items: center;
		margin: 20px auto;
	}

	.checked_button {
		position: fixed;
		bottom: 5%;
		left: 10%;
	}

	.vie {
		display: flex;
		justify-content: space-around;
	}

	.vie_zh {
		color: #a1a4a3;
	}

	.vie_zc {
		color: #56a5fa;
	}

	.dl_button {
		width: 80%;
		margin: 150px auto;
		background-color: #268dfe;
		font-size: 18px;
		color: #fff;
		text-align: center;
		height: 50px;
		line-height: 50px;
		border-radius: 30px;
	}

	.count_style {
		height: 25px;
		background-color: #358bff;
		color: #fff;
		padding: 10px;
		border-radius: 30px;
		text-align: center;
		line-height: 25px;
		margin-left: 20px;
		font-size: 14px;
	}

	.form_bc {
		width: 100%;
		margin-top: 50px;
	}

	.aaa {
		padding-top: 80px;
		height: 240px;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.aaa_text {
		margin-top: 35px;
		font-size: 22px;
		font-weight: 500;
	}

	.login_logo_img {
		width: 100px;
		height: 100px;
	}

	.uni-input-input {
		background-color: 'red' !important;
	}
</style>
